﻿using System.Text;
using System.Threading.Tasks;
using Model.Admin;
using Xproject.Framework.Utility.Extensions;
using Xproject.Framework.Core.Repositories;
using Xproject.Framework.Utility.ExceptionHandling;
using Xproject.Framework.Core;
using System.Linq.Expressions;
using Model.Admin.DTO;
using System;
using System.Linq;
using System.Collections.Generic;

namespace Repository.WXProjectAdmin
{
  public static  class AdminRoleMenuRep
    {
        public static List<AdminRoleMenu> GetRoleMenus(this IRepositoryAsync<AdminRoleMenu> repository, int roleID)
        {
            Expression<Func<AdminRoleMenu, bool>> express = i => 1 == 1;

            express = express.AndAlso(i => i.RoleId == roleID);

            return repository.Query().Where(express).Select().ToList();

        }
        public static List<AdminRoleMenu> GetRoleMenus(this IRepositoryAsync<AdminRoleMenu> repository, List<int> roleIDs)
        {
            Expression<Func<AdminRoleMenu, bool>> express = i => 1 == 1;
            express = express.AndAlso(i => roleIDs.Contains(i.RoleId ));
            return repository.Query().Where(express).Select().ToList();
        }
    }
}
